<!DOCTYPE html>
<html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-0 vector-toc-not-available vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-0 skin-theme-clientpref-day vector-sticky-header-enabled" lang="de" dir="ltr"><head>
<meta charset="UTF-8">
<title>String-Matching-Algorithmus</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="./_res_/favicon.png">
<link rel="canonical" href="https://de.wikipedia.org/wiki/String-Matching-Algorithmus"> <link href="./_mw_/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.math.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.wikimediamessages.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link href="./_mw_/ext.gadget.citeRef.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.defaultPlainlinks.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.dewikiCommonHide.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.dewikiCommonLayout.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.dewikiCommonStyle.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.dewikiDarkmode.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.dewikiResponsive.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.specialSearch.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="./_mw_/site.styles.css">
<link rel="stylesheet" type="text/css" href="./_mw_/noscript.css">
<link rel="stylesheet" type="text/css" href="./_res_/footer.css">
<link rel="stylesheet" type="text/css" href="./_res_/vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-String-Matching-Algorithmus rootpage-String-Matching-Algorithmus skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">String-Matching-Algorithmus</span></h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="contentSub">
<div id="mw-content-subtitle"></div>
</div>
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="de" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="de" dir="ltr"><p>In der Informatik sind <b>String-Matching-Algorithmen</b> eine Gruppe von <a href="Algorithmus" title="Algorithmus">Algorithmen</a>, die das Finden von Textsegmenten in einer <a href="Zeichenkette" title="Zeichenkette">Zeichenkette</a> (<span style="font-style:normal;font-weight:normal"><a href="Englische_Sprache" title="Englische Sprache">englisch</a></span> <span lang="en-Latn" style="font-style:italic">string</span>) anhand eines vorgegebenen Suchmusters beschreiben. Sie zählen somit zur Klasse der <a href="Zeichenkettenalgorithmus" title="Zeichenkettenalgorithmus">Zeichenkettenalgorithmen</a>.
</p><p>Im engeren Sinne suchen diese <a href="Algorithmus" title="Algorithmus">Algorithmen</a> nach exakten Übereinstimmungen (<span style="font-style:normal;font-weight:normal"><a href="Englische_Sprache" title="Englische Sprache">englisch</a></span> <span lang="en-Latn" style="font-style:italic">matches</span>). Im weiteren Sinne sind auch Algorithmen gemeint, die ungefähre Übereinstimmungen zulassen, wobei der Begriff <i><a href="Unscharfe_Suche" title="Unscharfe Suche">ungefähr</a></i> durch ein Toleranzkriterium genau definiert sein muss.
</p><p>Das Problem besteht darin, diese Aufgabe möglichst effizient zu lösen. In der Praxis ist dies bedeutsam, wenn in großen Textmengen (wie z. B. einer Wikipedia) Suchbegriffe gefunden werden sollen.
</p>
<div class="mw-heading mw-heading2"><h2 id="Exakte_Suche">Exakte Suche</h2></div>
<div class="mw-heading mw-heading3"><h3 id="Problemstellung">Problemstellung</h3></div>
<p>Grundsätzlich sind zwei Situationen zu unterscheiden:
</p>
<ol><li>Nach Vorgabe einer <i>Suchmaske</i> sollen beliebige <i>Texte</i> durchsucht werden.</li>
<li>Der <i>Text</i> ist vorgegeben, und dann sollen beliebige <i>Suchmasken</i> im Text gefunden werden.</li></ol>
<p>Der zweite Fall entspricht etwa der Aufgabe, die <a href="Wikipedia" title="Wikipedia">Wikipedia</a> derart aufzubereiten, dass beliebige Suchmasken schnell und effizient aufgefunden werden. Auch <a href="Suchmaschine" title="Suchmaschine">Suchmaschinen</a> im Internet finden sich in der zweiten Situation.
</p><p>Im Folgenden wird jedoch nur auf die erste Situation eingegangen.
</p>
<div class="mw-heading mw-heading3"><h3 id="Lösungsmethoden"><span id="L.C3.B6sungsmethoden"></span>Lösungsmethoden</h3></div>
<div class="mw-heading mw-heading4"><h4 id="Naiver_Algorithmus">Naiver Algorithmus</h4></div>
<p>Der einfachste Algorithmus besteht darin, ein so genanntes Suchfenster von der Länge der Suchmaske über den Text zu schieben. In jeder Position der Suchmaske werden die Symbole der Maske mit denen des darunterliegenden Textes verglichen.
Wenn ein nicht übereinstimmendes Symbol gefunden wird, wird das Fenster um eine Position verschoben, und erneut ein Vergleich angestellt; wenn alle Symbole im Fenster übereinstimmen, ist die Suchmaske gefunden worden. Der Algorithmus endet, wenn der ganze Text vom Fenster abgesucht worden ist.
</p><p>Dieser Algorithmus hat eine <a href="Zeitkomplexit%C3%A4t" title="Zeitkomplexität">Laufzeit</a> von der <a href="Landau-Notation" class="mw-redirect" title="Landau-Notation">Ordnung</a> <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \textstyle {\mathcal {O}}(n\cdot m)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mstyle displaystyle="false" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mi class="MJX-tex-caligraphic" mathvariant="script">O</mi>
</mrow>
</mrow>
<mo stretchy="false">(</mo>
<mi>n</mi>
<mo>⋅<!-- ⋅ --></mo>
<mi>m</mi>
<mo stretchy="false">)</mo>
</mstyle>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \textstyle {\mathcal {O}}(n\cdot m)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/3e773933a5915fcef708dad5b8a0d000fe246a6c.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:8.773ex; height:2.843ex;" alt="{\displaystyle \textstyle {\mathcal {O}}(n\cdot m)}" loading="lazy"></span>, wenn <i>m</i> die Länge der Suchmaske und <i>n</i> die Länge des Textes ist.
</p><p><b>Pseudocode:</b>
</p>
<pre><b>Eingabe</b>: Strings T = T<sub>1</sub>… T<sub>n</sub> und P = P<sub>1</sub> … P<sub>m</sub>
<b>Ausgabe</b>: q die Stellen, an denen P in T auftritt
</pre>
<div class="mw-highlight mw-highlight-lang-pascal mw-content-ltr" dir="ltr"><pre><span></span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">q</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="k">to</span><span class="w"> </span><span class="n">n</span><span class="w"> </span><span class="err">–</span><span class="w"> </span><span class="n">m</span><span class="w"> </span><span class="k">do</span>
<span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">P</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span><span class="p">[</span><span class="n">q</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span><span class="w"> </span><span class="k">and</span><span class="w"> </span><span class="n">P</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span><span class="p">[</span><span class="n">q</span><span class="o">+</span><span class="mi">2</span><span class="p">]</span><span class="w"> </span><span class="k">and</span><span class="w"> </span><span class="err">…</span><span class="w"> </span><span class="k">and</span><span class="w"> </span><span class="n">P</span><span class="p">[</span><span class="n">m</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span><span class="p">[</span><span class="n">q</span><span class="o">+</span><span class="n">m</span><span class="p">]</span><span class="w"> </span><span class="k">then</span>
<span class="w"> </span><span class="nb">write</span><span class="w"> </span><span class="n">q</span>
</pre></div>
<p>Überraschenderweise ist der naive Ansatz in der Praxis sehr schnell, da Fehler in natürlichsprachigen Texten nach 1 bis 2 Zeichen auftauchen. Für die englische Sprache ergibt sich eine Wahrscheinlichkeit von 1.07 Zeichen. Somit ist der naive Ansatz nahezu linear schnell.
</p><p>Dies wird auch deutlich wenn man sich den ungünstigsten Fall selbst ansieht. Er lautet
</p>
<pre>Text: aaa...aab
Muster: ab
</pre>
<p>Derartige Fälle sind in natürlich sprachlichen Texten äußerst unwahrscheinlich.
</p>
<div class="mw-heading mw-heading4"><h4 id="Endlicher_Automat">Endlicher Automat</h4></div>
<p>Bei dem String-Matching-Algorithmus mit Hilfe von <a href="Endlicher_Automat" title="Endlicher Automat">endlichen Automaten</a> wird ein für ein Alphabet <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Sigma }">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Σ<!-- Σ --></mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Sigma }</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/9e1f558f53cda207614abdf90162266c70bc5c1e.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.678ex; height:2.176ex;" alt="{\displaystyle \Sigma }" loading="lazy"></span> und ein gegebenes Suchmuster der Länge <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle m}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>m</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle m}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/0a07d98bb302f3856cbabc47b2b9016692e3f7bc.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:2.04ex; height:1.676ex;" alt="{\displaystyle m}" loading="lazy"></span> ein Automat <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle (Q,\Sigma ,\delta ,q_{0},\{q_{m}\})}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mo stretchy="false">(</mo>
<mi>Q</mi>
<mo>,</mo>
<mi mathvariant="normal">Σ<!-- Σ --></mi>
<mo>,</mo>
<mi>δ<!-- δ --></mi>
<mo>,</mo>
<msub>
<mi>q</mi>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
<mo>,</mo>
<mo fence="false" stretchy="false">{</mo>
<msub>
<mi>q</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>m</mi>
</mrow>
</msub>
<mo fence="false" stretchy="false">}</mo>
<mo stretchy="false">)</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle (Q,\Sigma ,\delta ,q_{0},\{q_{m}\})}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/b9f8ee017aef628bcef4f09053f000f3158f5196.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:17.638ex; height:2.843ex;" alt="{\displaystyle (Q,\Sigma ,\delta ,q_{0},\{q_{m}\})}" loading="lazy"></span> mit Zustandsmenge <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \textstyle Q=\{q_{i}\mid 0\leq i\leq m\}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mstyle displaystyle="false" scriptlevel="0">
<mi>Q</mi>
<mo>=</mo>
<mo fence="false" stretchy="false">{</mo>
<msub>
<mi>q</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>i</mi>
</mrow>
</msub>
<mo>∣<!-- ∣ --></mo>
<mn>0</mn>
<mo>≤<!-- ≤ --></mo>
<mi>i</mi>
<mo>≤<!-- ≤ --></mo>
<mi>m</mi>
<mo fence="false" stretchy="false">}</mo>
</mstyle>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \textstyle Q=\{q_{i}\mid 0\leq i\leq m\}}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/4513b18e48caabf761a4c1bd478462a5056a4d48.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:21.238ex; height:2.843ex;" alt="{\displaystyle \textstyle Q=\{q_{i}\mid 0\leq i\leq m\}}" loading="lazy"></span> erstellt. Dabei stellt <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \textstyle i}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mstyle displaystyle="false" scriptlevel="0">
<mi>i</mi>
</mstyle>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \textstyle i}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/b69dce609a74290821dcbd7db868b1af9c061fd4.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:0.802ex; height:2.176ex;" alt="{\displaystyle \textstyle i}" loading="lazy"></span> die Anzahl von übereinstimmenden Buchstaben an der aktuellen Stelle vom Anfang des Suchmusters an betrachtet dar. Zur Einfachheit sei <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \textstyle P_{i}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mstyle displaystyle="false" scriptlevel="0">
<msub>
<mi>P</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>i</mi>
</mrow>
</msub>
</mstyle>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \textstyle P_{i}}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/31b8c620fd51592c1bbf17483fc4c43ab15ec63d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:2.292ex; height:2.509ex;" alt="{\displaystyle \textstyle P_{i}}" loading="lazy"></span> das <a href="Pr%C3%A4fix" title="Präfix">Präfix</a> des Suchmusters bis einschließlich des Buchstabens an der Stelle <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \textstyle i}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mstyle displaystyle="false" scriptlevel="0">
<mi>i</mi>
</mstyle>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \textstyle i}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/b69dce609a74290821dcbd7db868b1af9c061fd4.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:0.802ex; height:2.176ex;" alt="{\displaystyle \textstyle i}" loading="lazy"></span>. Die Übergangsfunktion <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \delta (q_{i},a)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>δ<!-- δ --></mi>
<mo stretchy="false">(</mo>
<msub>
<mi>q</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>i</mi>
</mrow>
</msub>
<mo>,</mo>
<mi>a</mi>
<mo stretchy="false">)</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \delta (q_{i},a)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/4c230ced9ef3d91471a6f94a0915891e66173a4a.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:6.958ex; height:2.843ex;" alt="{\displaystyle \delta (q_{i},a)}" loading="lazy"></span> mit <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle a\in \Sigma }">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>a</mi>
<mo>∈<!-- ∈ --></mo>
<mi mathvariant="normal">Σ<!-- Σ --></mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle a\in \Sigma }</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/69a485a3b32b5e024b7b34f5e59c42e3d60337a2.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.749ex; height:2.176ex;" alt="{\displaystyle a\in \Sigma }" loading="lazy"></span> gibt nun für <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle 0\leq i\leq m-1}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mn>0</mn>
<mo>≤<!-- ≤ --></mo>
<mi>i</mi>
<mo>≤<!-- ≤ --></mo>
<mi>m</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle 0\leq i\leq m-1}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/ca4b2f05ce28398ed53128680921025e92b3fc4e.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.505ex; width:14.205ex; height:2.343ex;" alt="{\displaystyle 0\leq i\leq m-1}" loading="lazy"></span> wieder einen Zustand <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle q_{j}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mi>q</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>j</mi>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle q_{j}}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/e0d567ac2d170501680d2efa4c1d71d6a8569ef1.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:1.947ex; height:2.343ex;" alt="{\displaystyle q_{j}}" loading="lazy"></span> zurück, bei dem <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle j}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>j</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle j}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/2f461e54f5c093e92a55547b9764291390f0b5d0.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; margin-left: -0.027ex; width:0.985ex; height:2.509ex;" alt="{\displaystyle j}" loading="lazy"></span> die maximale Anzahl von Buchstaben darstellt, mit der <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle P_{j}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mi>P</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>j</mi>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle P_{j}}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/4a5da6c3564a2129f714ef11acd8ba649d18e604.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:2.402ex; height:2.843ex;" alt="{\displaystyle P_{j}}" loading="lazy"></span> ein <a href="Suffix" title="Suffix">Suffix</a> vom Wort <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle P_{i}a}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mi>P</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>i</mi>
</mrow>
</msub>
<mi>a</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle P_{i}a}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/62a5dc51b69f4c5d9dd577faada4dae9ab30cc33.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:3.522ex; height:2.509ex;" alt="{\displaystyle P_{i}a}" loading="lazy"></span> ist. Also <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \delta (q_{i},a)=q_{max\{j\mid P_{j}{\text{ ist Suffix von }}P_{i}a\}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>δ<!-- δ --></mi>
<mo stretchy="false">(</mo>
<msub>
<mi>q</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>i</mi>
</mrow>
</msub>
<mo>,</mo>
<mi>a</mi>
<mo stretchy="false">)</mo>
<mo>=</mo>
<msub>
<mi>q</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>m</mi>
<mi>a</mi>
<mi>x</mi>
<mo fence="false" stretchy="false">{</mo>
<mi>j</mi>
<mo>∣<!-- ∣ --></mo>
<msub>
<mi>P</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>j</mi>
</mrow>
</msub>
<mrow class="MJX-TeXAtom-ORD">
<mtext> ist Suffix von </mtext>
</mrow>
<msub>
<mi>P</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>i</mi>
</mrow>
</msub>
<mi>a</mi>
<mo fence="false" stretchy="false">}</mo>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \delta (q_{i},a)=q_{max\{j\mid P_{j}{\text{ ist Suffix von }}P_{i}a\}}}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/a1fa8aefb85012312dec1e91d91576c76f389d21.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.338ex; width:32.508ex; height:3.343ex;" alt="{\displaystyle \delta (q_{i},a)=q_{max\{j\mid P_{j}{\text{ ist Suffix von }}P_{i}a\}}}" loading="lazy"></span>. Ist das Suchmuster gefunden, wird im Endzustand verharrt, also <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \delta (q_{m},a)=q_{m}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>δ<!-- δ --></mi>
<mo stretchy="false">(</mo>
<msub>
<mi>q</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>m</mi>
</mrow>
</msub>
<mo>,</mo>
<mi>a</mi>
<mo stretchy="false">)</mo>
<mo>=</mo>
<msub>
<mi>q</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>m</mi>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \delta (q_{m},a)=q_{m}}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/b87ce96a948fa45faf9770262d7971770b2b60c5.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:13.644ex; height:2.843ex;" alt="{\displaystyle \delta (q_{m},a)=q_{m}}" loading="lazy"></span>.
</p><p>Der Vorteil dieses Algorithmus gegenüber dem naiven Algorithmus liegt darin, dass er auch beim Finden eines nicht-passenden Zeichens das erlangte Wissen über den bereits verarbeiteten Teil der Zeichenkette nicht verwirft. Angenommen, wir suchen das Muster <i>anax</i> im Text <i>ananax</i>. Trifft der automatenbasierte Algorithmus bei der Suche auf das Zweite <i>n</i> in <i><span style="color:#008000">ana</span><span style="color:#800000">n</span>ax</i>, so wird er die ersten beiden Buchstaben verwerfen und beginnend mit <i>an<span style="color:#008000">an</span>ax</i> weitersuchen. Der naive Algorithmus hingegen hätte den kompletten bereits verarbeiteten Teil verworfen und hätte beginnend mit <i>a<span style="color:#008000">n</span>anax</i> einen nächsten Versuch begonnen.
</p><p><b>Python-Implementation</b>
</p>
<div class="mw-highlight mw-highlight-lang-python mw-content-ltr" dir="ltr"><pre><span></span><span class="k">def</span><span class="w"> </span><span class="nf">is_suffix</span><span class="p">(</span><span class="n">suffix</span><span class="p">,</span> <span class="n">word</span><span class="p">):</span>
<span class="w"> </span><span class="sd">'''Überprüft ob das suffix ein Suffix von word ist.'''</span>
<span class="k">return</span> <span class="n">word</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="n">suffix</span><span class="p">)</span>
<span class="k">def</span><span class="w"> </span><span class="nf">transition</span><span class="p">(</span><span class="n">pattern</span><span class="p">,</span> <span class="n">state</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
<span class="w"> </span><span class="sd">'''Hier wird die Übergangsfunktion berechnet.'''</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">state</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">):</span>
<span class="k">if</span> <span class="n">is_suffix</span><span class="p">(</span><span class="n">pattern</span><span class="p">[:</span><span class="n">k</span><span class="p">],</span> <span class="n">pattern</span><span class="p">[:</span><span class="n">state</span><span class="p">]</span> <span class="o">+</span> <span class="n">event</span><span class="p">):</span>
<span class="k">return</span> <span class="n">k</span>
<span class="k">return</span> <span class="mi">0</span>
<span class="k">def</span><span class="w"> </span><span class="nf">create_matcher</span><span class="p">(</span><span class="n">alphabet</span><span class="p">,</span> <span class="n">pattern</span><span class="p">):</span>
<span class="w"> </span><span class="sd">'''Erzeugt alle Zustände und eine Übergangsfunktions-Tabelle'''</span>
<span class="n">transition_table</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">state</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">pattern</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span><span class="p">):</span>
<span class="k">for</span> <span class="n">event</span> <span class="ow">in</span> <span class="n">alphabet</span><span class="p">:</span>
<span class="n">transition_table</span><span class="p">[(</span><span class="n">state</span><span class="p">,</span> <span class="n">event</span><span class="p">)]</span> <span class="o">=</span> \
<span class="n">transition</span><span class="p">(</span><span class="n">pattern</span><span class="p">,</span> <span class="n">state</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
<span class="k">return</span> <span class="n">transition_table</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">pattern</span><span class="p">)</span>
<span class="k">def</span><span class="w"> </span><span class="nf">match</span><span class="p">(</span><span class="n">matcher</span><span class="p">,</span> <span class="n">text</span><span class="p">):</span>
<span class="w"> </span><span class="sd">'''Gibt die gefundenen Treffer im Text mit dem Automaten der aus create_matcher</span>
<span class="sd"> erstellt wurde.'''</span>
<span class="n">transition_table</span><span class="p">,</span> <span class="n">last_state</span> <span class="o">=</span> <span class="n">matcher</span>
<span class="n">matches</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">state</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">text_pos</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">for</span> <span class="n">text_pos</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">text</span><span class="p">)):</span>
<span class="n">state</span> <span class="o">=</span> <span class="n">transition_table</span><span class="p">[(</span><span class="n">state</span><span class="p">,</span> <span class="n">text</span><span class="p">[</span><span class="n">text_pos</span><span class="p">])]</span>
<span class="k">if</span> <span class="n">state</span> <span class="o">==</span> <span class="n">last_state</span><span class="p">:</span>
<span class="n">matches</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">text_pos</span> <span class="o">-</span> <span class="n">last_state</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
<span class="k">return</span> <span class="n">matches</span>
<span class="k">def</span><span class="w"> </span><span class="nf">find</span><span class="p">(</span><span class="n">alphabet</span><span class="p">,</span> <span class="n">pattern</span><span class="p">,</span> <span class="n">text</span><span class="p">):</span>
<span class="n">matcher</span> <span class="o">=</span> <span class="n">create_matcher</span><span class="p">(</span><span class="n">alphabet</span><span class="p">,</span> <span class="n">pattern</span><span class="p">)</span>
<span class="k">return</span> <span class="n">match</span><span class="p">(</span><span class="n">matcher</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span>
</pre></div>
<div class="mw-heading mw-heading4"><h4 id="Der_Knuth-Morris-Pratt-Algorithmus">Der Knuth-Morris-Pratt-Algorithmus</h4></div>
<p>Der <a href="Knuth-Morris-Pratt-Algorithmus" title="Knuth-Morris-Pratt-Algorithmus">Knuth-Morris-Pratt-Algorithmus</a> baut auf dem naiven Suchalgorithmus auf. Wesentlicher Unterschied ist, dass das Vergleichsfenster nicht immer um nur eine Position weitergerückt wird, sondern eventuell um mehr als eine Position.
</p><p>Dazu muss zu Anfang die Suchmaske analysiert werden, so dass bei jeder teilweisen Übereinstimmung, etwa der ersten <i>k</i> Symbole, bekannt ist, ob der Anfang der Suchmaske mit dem Ende der letzten übereinstimmenden Teilmaske übereinstimmt. Die Verschiebung der Suchmaske erfolgt nach der überlappenden Übereinstimmung; zusätzlicher Vorteil ist, dass die schon verglichenen Symbole nicht noch einmal verglichen werden müssen.
</p>
<div class="mw-heading mw-heading4"><h4 id="Suche_im_Suffixbaum">Suche im Suffixbaum</h4></div>
<p>Insbesondere wenn der zu durchsuchende Text im Voraus bekannt ist, und in diesem später nach vielen unterschiedlichen Mustern gesucht werden soll, bietet sich die Konstruktion eines <a href="Suffixbaum" title="Suffixbaum">Suffixbaums</a> an. Diese Konstruktion kann in <a href="Landau-Symbole" title="Landau-Symbole"><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \textstyle {\mathcal {O}}(n)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mstyle displaystyle="false" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mi class="MJX-tex-caligraphic" mathvariant="script">O</mi>
</mrow>
</mrow>
<mo stretchy="false">(</mo>
<mi>n</mi>
<mo stretchy="false">)</mo>
</mstyle>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \textstyle {\mathcal {O}}(n)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/14f3ed5ee67068a3618a144e8b2111fe62e1415b.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:5.054ex; height:2.843ex;" alt="{\displaystyle \textstyle {\mathcal {O}}(n)}" loading="lazy"></span></a> erfolgen. Anschließend kann jedes Muster ohne erneute Vorbereitung des Texts in <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \textstyle {\mathcal {O}}(m)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mstyle displaystyle="false" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mi class="MJX-tex-caligraphic" mathvariant="script">O</mi>
</mrow>
</mrow>
<mo stretchy="false">(</mo>
<mi>m</mi>
<mo stretchy="false">)</mo>
</mstyle>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \textstyle {\mathcal {O}}(m)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/32b3a9961222cecce1d8188715b8ef6d6530859e.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:5.7ex; height:2.843ex;" alt="{\displaystyle \textstyle {\mathcal {O}}(m)}" loading="lazy"></span> gesucht werden: Sofern es vorhanden ist, kann man von der Quelle des Suffixbaums den entsprechenden Knoten erreichen, ansonsten schlägt die Suche fehl (es ist kein entsprechender Knoten vorhanden).<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading3"><h3 id="Übersicht"><span id=".C3.9Cbersicht"></span>Übersicht</h3></div>
<table class="wikitable">
<tbody><tr>
<th>Algorithmus
</th>
<th>Vorbereitungszeit
</th>
<th><a href="Zeitkomplexit%C3%A4t" title="Zeitkomplexität">Suchzeit</a>
</th></tr>
<tr>
<td>Naiver Algorithmus
</td>
<td><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle 0}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mn>0</mn>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle 0}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/2aae8864a3c1fec9585261791a809ddec1489950.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.162ex; height:2.176ex;" alt="{\displaystyle 0}" loading="lazy"></span> (keine)
</td>
<td><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(\left(n-m+1\right)\cdot m\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mrow>
<mrow>
<mo>(</mo>
<mrow>
<mi>n</mi>
<mo>−<!-- − --></mo>
<mi>m</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
<mo>)</mo>
</mrow>
<mo>⋅<!-- ⋅ --></mo>
<mi>m</mi>
</mrow>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(\left(n-m+1\right)\cdot m\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/7279d9cb0415f308206a92eac1148eba460f33cc.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:19.812ex; height:2.843ex;" alt="{\displaystyle \Theta \left(\left(n-m+1\right)\cdot m\right)}" loading="lazy"></span>
</td></tr>
<tr>
<td><a href="Rabin-Karp-Algorithmus" title="Rabin-Karp-Algorithmus">Rabin-Karp-Algorithmus</a>
</td>
<td><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(m\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mi>m</mi>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(m\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/c1fac36dd016e3eb6bb57f00fae9a08a7a55d9bc.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:6.045ex; height:2.843ex;" alt="{\displaystyle \Theta \left(m\right)}" loading="lazy"></span>
</td>
<td>average <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(n+m\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mrow>
<mi>n</mi>
<mo>+</mo>
<mi>m</mi>
</mrow>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(n+m\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/548fc0ba1a2305096e270a17a66c47b106298682.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:10.28ex; height:2.843ex;" alt="{\displaystyle \Theta \left(n+m\right)}" loading="lazy"></span>,<br>worst <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(n\cdot m\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mrow>
<mi>n</mi>
<mo>⋅<!-- ⋅ --></mo>
<mi>m</mi>
</mrow>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(n\cdot m\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/fdc704d9de72c93d5e78ae9b401b1e3a93152147.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:9.119ex; height:2.843ex;" alt="{\displaystyle \Theta \left(n\cdot m\right)}" loading="lazy"></span>
</td></tr>
<tr>
<td><a href="Endlicher_Automat" title="Endlicher Automat">Endlicher Automat</a>
</td>
<td><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\mathcal {O}}\left(m\cdot |\Sigma |\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mi class="MJX-tex-caligraphic" mathvariant="script">O</mi>
</mrow>
</mrow>
<mrow>
<mo>(</mo>
<mrow>
<mi>m</mi>
<mo>⋅<!-- ⋅ --></mo>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi mathvariant="normal">Σ<!-- Σ --></mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
</mrow>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {\mathcal {O}}\left(m\cdot |\Sigma |\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/a4bd499ca80583c9f3d7e0fd04b42b528ac9a590.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:10.738ex; height:2.843ex;" alt="{\displaystyle {\mathcal {O}}\left(m\cdot |\Sigma |\right)}" loading="lazy"></span>
</td>
<td><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(n\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mi>n</mi>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(n\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/e28f21ea5b5690e06e43c6cb237bd0709dd36cd3.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:5.399ex; height:2.843ex;" alt="{\displaystyle \Theta \left(n\right)}" loading="lazy"></span>
</td></tr>
<tr>
<td><a href="Knuth-Morris-Pratt-Algorithmus" title="Knuth-Morris-Pratt-Algorithmus">Knuth-Morris-Pratt-Algorithmus</a>
</td>
<td><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(m\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mi>m</mi>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(m\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/c1fac36dd016e3eb6bb57f00fae9a08a7a55d9bc.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:6.045ex; height:2.843ex;" alt="{\displaystyle \Theta \left(m\right)}" loading="lazy"></span>
</td>
<td><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(n\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mi>n</mi>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(n\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/e28f21ea5b5690e06e43c6cb237bd0709dd36cd3.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:5.399ex; height:2.843ex;" alt="{\displaystyle \Theta \left(n\right)}" loading="lazy"></span>
</td></tr>
<tr>
<td><a href="Boyer-Moore-Algorithmus" title="Boyer-Moore-Algorithmus">Boyer-Moore-Algorithmus</a><sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</td>
<td><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(m\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mi>m</mi>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(m\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/c1fac36dd016e3eb6bb57f00fae9a08a7a55d9bc.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:6.045ex; height:2.843ex;" alt="{\displaystyle \Theta \left(m\right)}" loading="lazy"></span>
</td>
<td>average <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(n/m\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mrow>
<mi>n</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo>/</mo>
</mrow>
<mi>m</mi>
</mrow>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(n/m\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/844a173e2d251d6a6ec94db577d3009a8fccdf78.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:8.602ex; height:2.843ex;" alt="{\displaystyle \Theta \left(n/m\right)}" loading="lazy"></span>,<br>worst <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(n\cdot m\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mrow>
<mi>n</mi>
<mo>⋅<!-- ⋅ --></mo>
<mi>m</mi>
</mrow>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(n\cdot m\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/fdc704d9de72c93d5e78ae9b401b1e3a93152147.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:9.119ex; height:2.843ex;" alt="{\displaystyle \Theta \left(n\cdot m\right)}" loading="lazy"></span>
</td></tr>
<tr>
<td><a href="Shift-Or-Algorithmus" class="mw-redirect" title="Shift-Or-Algorithmus">Shift-Or-Algorithmus</a>
</td>
<td><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(m+|\Sigma |\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mrow>
<mi>m</mi>
<mo>+</mo>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi mathvariant="normal">Σ<!-- Σ --></mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
</mrow>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(m+|\Sigma |\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/14516385de3512575ce6b20cee927d11c41e8e19.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:11.857ex; height:2.843ex;" alt="{\displaystyle \Theta \left(m+|\Sigma |\right)}" loading="lazy"></span>
</td>
<td><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(n\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mi>n</mi>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(n\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/e28f21ea5b5690e06e43c6cb237bd0709dd36cd3.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:5.399ex; height:2.843ex;" alt="{\displaystyle \Theta \left(n\right)}" loading="lazy"></span>
</td></tr>
<tr>
<td>Suche im <a href="Suffixbaum" title="Suffixbaum">Suffixbaum</a>
</td>
<td><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(n\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mi>n</mi>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(n\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/e28f21ea5b5690e06e43c6cb237bd0709dd36cd3.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:5.399ex; height:2.843ex;" alt="{\displaystyle \Theta \left(n\right)}" loading="lazy"></span>
</td>
<td><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Theta \left(m\right)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Θ<!-- Θ --></mi>
<mrow>
<mo>(</mo>
<mi>m</mi>
<mo>)</mo>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Theta \left(m\right)}</annotation>
</semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/c1fac36dd016e3eb6bb57f00fae9a08a7a55d9bc.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:6.045ex; height:2.843ex;" alt="{\displaystyle \Theta \left(m\right)}" loading="lazy"></span>
</td></tr></tbody></table>
<p>Wobei <i>m</i> die Länge der Suchmaske und <i>n</i> die Länge des Textes ist.
</p>
<div class="mw-heading mw-heading3"><h3 id="Weitere_Algorithmen">Weitere Algorithmen</h3></div>
<ul><li>Skip-Search-Algorithmus</li>
<li><a href="Baeza-Yates-Gonnet-Algorithmus" title="Baeza-Yates-Gonnet-Algorithmus">Baeza-Yates-Gonnet-Algorithmus</a> (Shift-Or oder Shift-And)</li>
<li>BNDM (Backward Nondeterministic Dawg Matching)</li>
<li>BOM (Backward Oracle Matching)</li></ul>
<div class="mw-heading mw-heading2"><h2 id="Multi-String-Matching">Multi-String-Matching</h2></div>
<p>Die Suche nach mehreren Mustern in einem Text nennt sich Multi-String-Matching<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>. Die meisten Algorithmen sind abgeleitet von einem entsprechenden String-Matching Algorithmus für genau ein Muster. Eine besondere Herausforderung bei der Suche nach mehreren Suchwörtern ist die Behandlungen von Wort-Überlappungen.
</p>
<div class="mw-heading mw-heading3"><h3 id="Liste_von_Algorithmen">Liste von Algorithmen</h3></div>
<table class="wikitable">
<tbody><tr>
<th>Multi-String-Algorithmus</th>
<th>passender Single-String-Algorithmus
</th></tr>
<tr>
<td>Multi-Shift-And</td>
<td>Shift-And
</td></tr>
<tr>
<td><a href="Aho-Corasick-Algorithmus" title="Aho-Corasick-Algorithmus">Aho-Corasick</a></td>
<td>Knuth-Morris-Pratt
</td></tr>
<tr>
<td>Commentz-Walter</td>
<td>Boyer-Moore
</td></tr>
<tr>
<td>Set-Horspool</td>
<td>Horspool
</td></tr>
<tr>
<td>Wu-Manber</td>
<td>Horspool/Rabin-Karp
</td></tr>
<tr>
<td>Set-BOM</td>
<td>BOM
</td></tr></tbody></table>
<div class="mw-heading mw-heading2"><h2 id="Mustervergleichssuche">Mustervergleichssuche</h2></div>
<div class="hauptartikel" role="navigation"><span class="hauptartikel-pfeil" title="siehe" aria-hidden="true" role="presentation">→ </span><i><span class="hauptartikel-text">Hauptartikel</span>: <a href="Pattern_Matching" title="Pattern Matching">Pattern Matching</a></i></div>
<p>Die Suche nach Mustern ist zwischen unscharfer und exakter Suche anzusiedeln, da der Benutzer explizit angeben muss, welchen Spielraum er für bestimmte Zeichenklassen an bestimmten String-Positionen zulässt.
</p>
<div class="mw-heading mw-heading2"><h2 id="Unscharfe_Suche">Unscharfe Suche</h2></div>
<div class="hauptartikel" role="navigation"><span class="hauptartikel-pfeil" title="siehe" aria-hidden="true" role="presentation">→ </span><i><span class="hauptartikel-text">Hauptartikel</span>: <a href="Unscharfe_Suche" title="Unscharfe Suche">unscharfe Suche</a> und <a href="Phonetische_Suche" title="Phonetische Suche">phonetische Suche</a></i></div>
<p>Bei der unscharfen Suche entscheidet üblicherweise der Algorithmus nach Vorgabe eines Güte- oder Abstandskriteriums, wie groß die Abweichung von Treffern gehen darf.
</p><p>Diese Form der Suche umfasst auch Suchen nach gleichlautenden Wörtern in einem Text (phonetische Suche). Beispiele von Algorithmen sind:
</p>
<ul><li><a href="Soundex" title="Soundex">Soundex</a></li>
<li><a href="K%C3%B6lner_Phonetik" title="Kölner Phonetik">Kölner Phonetik</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="Siehe_auch">Siehe auch</h2></div>
<ul><li><a href="Suchverfahren" title="Suchverfahren">Suchverfahren</a></li>
<li><a href="Levenshtein-Distanz" title="Levenshtein-Distanz">Levenshtein-Distanz</a> (approximative Suche)</li>
<li><a href="Gestalt_Pattern_Matching" title="Gestalt Pattern Matching">Gestalt Pattern Matching</a> (approximative Suche)</li>
<li><a href="Volltextrecherche" title="Volltextrecherche">Volltextrecherche</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="Weblinks">Weblinks</h2></div>
<ul><li><a rel="nofollow" class="external text" href="http://www-igm.univ-mlv.fr/~lecroq/string/">Java-Animationen, die die Funktionsweise so gut wie aller exakten Suchalgorithmen veranschaulichen</a></li>
<li><a rel="nofollow" class="external text" href="http://johannburkard.de/software/stringsearch/">StringSearch – high-performance pattern matching algorithms in Java</a> – Implementierungen vieler String-Matching-Algorithmen in Java (BNDM, Boyer-Moore-Horspool, Boyer-Moore-Horspool-Raita, Shift-Or)</li>
<li><a rel="nofollow" class="external text" href="http://stringsandchars.amygdalum.net/">StringsAndChars</a> – Implementierungen von String-Matching-Algorithmen für ein und mehrere Muster in Java.</li>
<li><a rel="nofollow" class="external text" href="http://www.iti.fh-flensburg.de/lang/algorithmen/pattern/bm.htm">einfache und ausführliche Erklärung des Boyer-Moore-Algorithmus</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="Einzelnachweise">Einzelnachweise</h2></div>
<ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Dan Gusfield: <cite style="font-style:italic">Algorithms on Strings, Sequences and Trees</cite>. 1997, ISBN 0-521-58519-8, Kapitel 7.1.APL1 (1999 korrigierte Ausgabe).<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abookitem&rfr_id=info:sid/de.wikipedia.org:String-Matching-Algorithmus&rft.atitle=Kapitel+7.1.APL1&rft.au=Dan+Gusfield&rft.btitle=Algorithms+on+Strings%2C+Sequences+and+Trees&rft.date=1997&rft.genre=bookitem&rft.isbn=0521585198" style="display:none"> </span></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">R. S. Boyer, J. S. Moore: <cite style="font-style:italic">A fast string searching algorithm</cite>. In: <cite style="font-style:italic"><a href="Communications_of_the_ACM" title="Communications of the ACM">Communications of the ACM</a></cite>. 20. Jahrgang, 1977, <span style="white-space:nowrap">S.<span style="display:inline-block;width:.2em"> </span>762–772</span>, <a href="Digital_Object_Identifier" title="Digital Object Identifier">doi</a>:<span class="uri-handle" style="white-space:nowrap"><a rel="nofollow" class="external text" href="https://doi.org/10.1145/359842.359859">10.1145/359842.359859</a></span>.<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rfr_id=info:sid/de.wikipedia.org:String-Matching-Algorithmus&rft.atitle=A+fast+string+searching+algorithm&rft.au=R.+S.+Boyer%2C%26%2332%3BJ.+S.+Moore&rft.btitle=Communications+of+the+ACM&rft.date=1977&rft.doi=10.1145%2F359842.359859&rft.genre=book&rft.pages=762-772&rft.volume=20.+Jahrgang" style="display:none"> </span></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><a href="#cite_ref-3">↑</a></span> <span class="reference-text">Gonzalo Navarro, Mathieu Raffinot: <cite style="font-style:italic">Flexible Pattern Matching Strings: Practical On-Line Search Algorithms for Texts and Biological Sequences</cite>. 2008, ISBN 0-521-03993-2.<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rfr_id=info:sid/de.wikipedia.org:String-Matching-Algorithmus&rft.au=Gonzalo+Navarro%2C+Mathieu+Raffinot&rft.btitle=Flexible+Pattern+Matching+Strings%3A+Practical+On-Line+Search+Algorithms+for+Texts+and+Biological+Sequences&rft.date=2008&rft.genre=book&rft.isbn=0521039932" style="display:none"> </span></span>
</li>
</ol></div><!--htdig_noindex--><div><div class="zim-footer">
Dieser Artikel wurde von <a class="external text" title="Zuletzt bearbeitet am 2022-10-29" href="https://de.wikipedia.org/wiki/?title=String-Matching-Algorithmus&oldid=227452349">Wikipedia</a> herausgegeben. Der Text ist unter <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.de">Creative Commons Attribution-Share Alike 4.0</a> verfügbar, sofern nicht anders angegeben. Für die Mediendateien können zusätzliche Bedingungen gelten.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
<script src="./_webp_/webpHandler.js"></script>
</body></html>